package org.esti.model.dao;

import org.esti.model.Book;
import org.esti.model.KnowledgeField;
import org.esti.model.User;

import java.util.List;

/**
 * @author Artem Loginov (logart)
 */
public interface BookDAO {

    /**
     * get specific book using id
     * @param id of book wich will be returned from DB
     * @return book instance
     */
    Book getBookById(long id);

    /**
     * all book which was published by specific user user
     * @param user which is publisher of returned books
     * @return list of books
     */
    List<Book> getUsersBooks(User user);

    /**
     * get list of books which are needed to know specific knowledge field id
     * @param knowledgeFieldId books for this knowledge field will be returned
     * @return list of books
     */
    List<Book> getKnowledgeFieldBooks(KnowledgeField knowledgeFieldId);

    /**
     * update specific book in DB
     * @param book with updated fields which will be saved to DB
     * @return updated book instance
     */
    Book update(Book book);

    /**
     * delete specific book from db
     * @param book which will be deleted
     */
    void deleteBook(Book book);

    /**
     * return list all books
     * @return list of books
     */
    List<Book> getAllBooks();
}
